﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using KinectTD.Towers;
namespace KinectTD.UI
{
    class TowerButton : Button
    {
        private Tower tower;
        private SpriteFont font;
        private Vector2 textPosition;


        /// <summary>
        /// The tower associated with the button
        /// </summary>
        public Tower Tower
        {
            get { return tower; }
            set { tower = value; }
        }



        public TowerButton(string assetName, Tower towerType)
            : base(assetName)
        {
            this.tower = towerType;
            this.size = new Vector2(100, 100);
            tower.Position = this.position;
            tower.Size = this.size - (this.size /4);

         
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            textPosition = new Vector2(this.position.X + 30, this.size.Y - Engine.StringLength("C", font).Y - 25);
        }

        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            tower.Draw(spriteBatch);


            spriteBatch.DrawString(font, "Cost: " + tower.Cost , textPosition, Color.White);

        }

        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager Content)
        {
            base.LoadContent(Content);
            font = Content.Load<SpriteFont>("Towers/scoreFont");
        }


    }
}
